package org.test.thread;

import org.apache.poi.ss.formula.functions.T;

public class Runnable01 implements Runnable {

    private static int ticket=10;

    @Override
    public void run() {
        while (true){
            if (ticket<=0){
                break;
            }
            System.out.println(Thread.currentThread().getName()+"--->拿到了第"+(ticket--)+"张票！");
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                System.out.println(e.getMessage());
            }
        }
    }

    public static void main(String[] args) {
        Runnable01 ticket=new Runnable01();
        new Thread(ticket,"ll").start();
        new Thread(ticket,"zz").start();
        new Thread(ticket,"aa").start();
    }
}
